package com.fy.spring.controller;


import com.fy.spring.serivce.PaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/payment")
public class PaymentController {

    @Autowired
    private PaymentService paymentService;

    @Value("${server.port}")
    private String serverPort;


    @GetMapping(value = "/lb")
    public String lb() {
        return serverPort;
    }


    @GetMapping("/timeout")
    public String timeout(@RequestParam int second) {
        return paymentService.timeout(second);
    }

    @GetMapping("/exception")
    public String makeException(){
        return paymentService.makeException();
    }
}
